#include<signal.h>
#include<iostream>
#include<stdlib.h>
#include<string.h>
using namespace std;
struct sigaction act;
int main()
{
    act.sa_flags=0;
    act.sa_handler=SIG_IGN;
    cout<<"SIGTSTP is ignored"<<endl;
    if(sigaction(SIGTSTP,&act,NULL)==-1)
        perror("failed to set handler for SIGTSTP");
    sleep(10);
    cout<<"SIGTSTP handler is restored"<<endl;
    act.sa_handler=SIG_DFL;
    if(sigaction(SIGTSTP,&act,NULL)==-1)
        perror("failed to restore handler for SIGTSTP");
    for(;;);
    return 0;
}